class Solution {
public:
    vector<vector<int>> ret;
    void dfs(vector<int>& nums, vector<int> tmp)
    {
        ret.push_back(tmp);
        for(int i = 0; i < nums.size(); i++)
        {
            if(tmp.size() == 0 || nums[i] > tmp.back())
            {
                tmp.push_back(nums[i]);
                dfs(nums, tmp);
                tmp.pop_back();
            }
        }
    }
    vector<vector<int>> subsets(vector<int>& nums) {
        sort(nums.begin(), nums.end());
        dfs(nums, vector<int>());
        return ret;
    }
};